﻿using dotHTML.HTML;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Text;
using System.Collections.Generic;
#pragma warning disable 0618
namespace TestdotHTML
{
    
    
    /// <summary>
    ///This is a test class for LinkTest and is intended
    ///to contain all LinkTest Unit Tests
    ///</summary>
    [TestClass()]
    public class LinkTest {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext {
            get {
                return testContextInstance;
            }
            set {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for Link Constructor
        ///</summary>
        [TestMethod()]
        public void LinkConstructorTest() {
            Link target = new Link("href");
            Assert.AreEqual("<link href=\"href\"/>", target.ToString());
        }

        /// <summary>
        ///A test for Charset
        ///</summary>
        [TestMethod()]
        public void CharsetTest() {
            Link target = new Link("href");
            string expected = string.Empty;
            string actual;
            target.Charset = expected;
            actual = target.Charset;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Href
        ///</summary>
        [TestMethod()]
        public void HrefTest() {
            Link target = new Link("href");
            string expected = string.Empty;
            string actual;
            target.Href = expected;
            actual = target.Href;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for HrefLang
        ///</summary>
        [TestMethod()]
        public void HrefLangTest() {
            Link target = new Link("href");
            string expected = string.Empty;
            string actual;
            target.HrefLang = expected;
            actual = target.HrefLang;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Media
        ///</summary>
        [TestMethod()]
        public void MediaTest() {
            Link target = new Link("href");
            string expected = string.Empty;
            string actual;
            target.Media = expected;
            actual = target.Media;
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for Rel
        ///</summary>
        [TestMethod()]
        public void RelTest() {
            Link target = new Link("href");
            target.Rel.Add("ac1");
            target.Rel.Add("ac2");
            Assert.IsTrue(target.Rel.Count == 2);
            Assert.IsTrue(target.Rel.Contains("ac1"));
            Assert.IsTrue(target.Rel.Contains("ac2"));
        }

        /// <summary>
        ///A test for Rev
        ///</summary>
        [TestMethod()]
        public void RevTest() {
            Link target = new Link("href");
            target.Rev.Add("ac1");
            target.Rev.Add("ac2");
            Assert.IsTrue(target.Rev.Count == 2);
            Assert.IsTrue(target.Rev.Contains("ac1"));
            Assert.IsTrue(target.Rev.Contains("ac2"));
        }

        /// <summary>
        ///A test for Sizes
        ///</summary>
        [TestMethod()]
        public void SizesTest() {
            Link target = new Link("href");
            target.Sizes.Add("ac1");
            target.Sizes.Add("ac2");
            Assert.IsTrue(target.Sizes.Count == 2);
            Assert.IsTrue(target.Sizes.Contains("ac1"));
            Assert.IsTrue(target.Sizes.Contains("ac2"));
        }

        /// <summary>
        ///A test for Type
        ///</summary>
        [TestMethod()]
        public void TypeTest() {
            Link target = new Link("href");
            string expected = string.Empty;
            string actual;
            target.Type = expected;
            actual = target.Type;
            Assert.AreEqual(expected, actual);
        }

        [TestMethod()]
        public void ToStringTest() {
            Link l = new Link("href");
            l.Charset = "charset";
            l.HrefLang = "hreflang";
            l.Media = "media";
            l.Rel.Add("rel1");
            l.Rel.Add("rel2");
            l.Rev.Add("rev1");
            l.Rev.Add("rev2");
            l.Sizes.Add("AxB");
            l.Sizes.Add("CxD");
            l.Type = "type";
            Assert.AreEqual("<link charset=\"charset\" " +
                "href=\"href\" " +
                "hreflang=\"hreflang\" " +
                "media=\"media\" " +
                "rel=\"rel1 rel2 \" " +
                "rev=\"rev1 rev2 \" " +
                "sizes=\"AxB CxD \" " +
                "type=\"type\"/>", l.ToString());
        }
    }
}
